Please explain 'defaultdict' concept based on the below code